<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .box{
            position: absolute;
            top: 100px;
            left: 100px;
            width: 400px;
            height: 100px;
            background-color: pink;
        }
        .one{
            position: relative;
            top: 10px;
            width: 200px;
            height: 100%;
        }
        .two{
            position: relative;
            top: 10px;
            width: 200px;
            height: 100%;
        }
        .three{
            position: relative;
            top: 10px;
        }
        ul{
            list-style-type: none;
            text-decoration: none;
        }
        a{
            text-decoration: none;
            color: black;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul class="nav">
            <li class="one">
                <a href="#">家用电器</a>
                <ul>
                    <li>
                        <a href="">电视</a>
                    </li>
                    <li>
                        <a href="">空调</a>
                    </li>
                    <li>
                        <a href="">冰箱</a>
                    </li>
                </ul>
            </li>
            <li class="two">
                <a href="#">童装童鞋</a>
                <ul>
                    <li>
                        <a href="">男童装</a>
                    </li>
                    <li>
                        <a href="">女童装</a>
                    </li>
                </ul>
            </li>
            <li class="three">
                <a href="#">体育用品</a>
                <ul>
                    <li>
                        <a href="">羽毛球</a>
                    </li>
                    <li>
                        <a href="">篮球</a>
                    </li>
                    <li>
                        <a href="">足球</a>
                    </li>
                    <li>
                        <a href="">乒乓球</a>
                    </li>
                </ul>
            </li>
        </ul>
    </div>
    <script>
        let nav = document.querySelector('.nav');
        let lis = nav.children;
        for(let i = 0;i<lis.length;i++){
            lis[i].onmouseover = function(){
                this.children[1].style.display = 'block';
            };
            lis[i].onmouseout= function(){
                this.children[1].style.display = 'none';
            };
        }
    </script>
</body>
</html>